package com.xbongbong.paas.help.symbol;

import com.xbongbong.paas.domain.entity.PaasFormDataEntity;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.toolbox.exception.XbbException;

/**
 * 流水号进行判断
 *
 * @author 吴峰
 * @date 2021/01/07 14:32
 */
public class SerialNoSymbolHandle extends TextSymbolHandle {

    @Override
    public boolean equals(Object target, PaasFormDataEntity source, FieldAttrEntity fieldAttrEntity) throws XbbException {
        return equals(target, source.getSerialNo());
    }

    @Override
    public boolean noEquals(Object target, PaasFormDataEntity source, FieldAttrEntity fieldAttrEntity) throws XbbException {
        return noEquals(target, source.getSerialNo());
    }

    @Override
    public boolean empty(PaasFormDataEntity source, FieldAttrEntity fieldAttrEntity) throws XbbException {
        return empty(source.getSerialNo());
    }

    @Override
    public boolean noEmpty(PaasFormDataEntity source, FieldAttrEntity fieldAttrEntity) throws XbbException {
        return noEmpty(source.getSerialNo());
    }

    @Override
    public boolean like(Object target, PaasFormDataEntity source, FieldAttrEntity fieldAttrEntity) throws XbbException {
        return source.getSerialNo().contains(target.toString());
    }

    @Override
    public boolean noLike(Object target, PaasFormDataEntity source, FieldAttrEntity fieldAttrEntity) throws XbbException {
        return !source.getSerialNo().contains(target.toString());
    }

    @Override
    public boolean in(Object target, PaasFormDataEntity source, FieldAttrEntity fieldAttrEntity) throws XbbException {
        return in(target, source.getSerialNo());
    }

    @Override
    public boolean noIn(Object target, PaasFormDataEntity source, FieldAttrEntity fieldAttrEntity) throws XbbException {
        return noIn(target, source.getSerialNo());
    }
}
